#ifndef FACTORY_H
#define FACTORY_H

#include <string>
#include <map>
#include "MyGame.h"
#include "BaseUnit.h"
#include "Level.h"
#include "LevelMap.h"
#include "BaseTrigger.h"
#include "Overlay.h"
#include "LevelList.h"
#include "StringUtility.h"
#include "SpawnUnitData.h"

using namespace StringUtility;

class Factory {
    private:
        Factory();
        static Factory* m_factory;
    public:
        ~Factory();
        static Factory* GetFactory();
        // hero
        BaseUnit* GetHero(Level *level, CRstring classname, const Vector2df p, const Vector2df v);
        BaseUnit* GetHero(Level *level, CRstring descriptor, int tileSize); // from a line from a level-file

        // units
        BaseUnit* GetSprite(Level *level, CRstring classname, const Vector2df p, const Vector2df v, CRstring parameter);
        BaseUnit* GetSprite(Level *level, CRstring classname, const Vector2df p, const Vector2df v);
        BaseUnit* GetGenericSprite(Level *level, CRstring classname, const Vector2df p, const Vector2df v, CRstring parameter);

        // trigger
        BaseTrigger* GetTrigger(Level *level, CRstring classname, const Vector2df p, const Vector2df s, CRstring parameter);
        BaseTrigger* GetTrigger(Level *level, CRstring classname, const Vector2df p, const Vector2df s);
        BaseTrigger* GetTrigger(Level *level, CRstring descriptor, int tileSize);

		// overlay
        Overlay* GetOverlay(LevelMap *lmp, CRstring classname, CRstring identifier, CRstring imagefile, const Vector2di p, const Vector2di s, uint transparentColour);
        Overlay* GetOverlay(LevelMap *lmp, CRstring classname, CRstring identifier, CRstring imagefile, CRstring target, const Vector2di p, const Vector2di s, uint transparentColour);
        Overlay* GetOverlay(LevelMap *lmp, CRstring descriptor, uint transparentColour);

        // spawnUnitData from a line of a level-file
        SpawnUnitData* GetSprite(CRstring descriptor, int tileSize);
        SpawnUnitData* GetTrigger(CRstring descriptor, int tileSize);

        // level
        WandorBaseState *GetLevel(CRstring descriptor);
        WandorBaseState *GetLevel(LevelData levelData);
};

#endif /*FACTORY_H_*/
